using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using ECommerce.Library.DataStructure;
using AutoGear.BLL;
using System.Collections.Generic;
using ECommerce.Library;
using eShop.Model;
using eShop.Business;

public partial class catalog : SitePublicBasePage
{
    private int _maxItem = 0;

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            this._maxItem = 8;
            LoadRepeaterItems();
        }
    }

    protected void LoadRepeaterItems()
    {
        ReadWriteCustomCollection<Manufacturer> productBrandCollection = ManufacturerManager.ActiveBrands(this._maxItem);
        rptVertical.DataSource = productBrandCollection;
        rptVertical.DataBind();
    }

    protected void rptVertical_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
        {
            Image imgCatalog = (Image)e.Item.FindControl("imgCatalog");
            Manufacturer productBrand = (Manufacturer)e.Item.DataItem;
            if (imgCatalog != null && productBrand != null)
            {
                imgCatalog.ImageUrl = ImageResizer.CheckImageMissing(productBrand.BrandImageUrl, AutoGear.BLL.SiteSettings.NoImageUrl);
            }
        }
    }
}
